package org.glut.dao;

import org.apache.ibatis.annotations.*;
import org.glut.bean.User;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.Mapping;

import java.util.ArrayList;

@Mapper
public interface UserDao {
    @Select("select * from user where name = #{name}")
    public User getUserByname(@Param("name") String name);

    @Select("select * from user")
    public ArrayList<User> getAllUsers();

    @Update("update user set name = #{name},password = #{password},role = #{role} where  id = #{id} ")
    public boolean updateUser(User user);

    @Delete("delete from user where name = #{name}")
    public boolean deleteUserByName(String name);

    @Insert("insert into user(id,name,password,role) values (#{id},#{name},#{password},#{role})")
    public boolean addUser(User user);
}
